package com.leetcode.题库;

import com.leetcode.common.model.TreeNode;

/**
 * @author 覃国强
 * @date 2022-05-01 11:02
 */
public class 题库_0701_二叉搜索树中的插入操作 {


  static
  class Solution {
    public TreeNode insertIntoBST(TreeNode root, int val) {
      if (root == null) {
        return new TreeNode(val);
      }
      if (val < root.val) {
        root.left = insertIntoBST(root.left, val);
      } else {
        root.right = insertIntoBST(root.right, val);
      }
      return root;
    }
  }

}
